import { fetchSys, putSys } from './service';
  
const Model = {
    namespace: 'setupandsystem',
    state: {
        
    },

    effects: {
        *getNKN(_ , { call }) {
            const response = yield call(fetchSys, 1)
            if (response) {
                return { status: 200, data: response}
            }
            return { status: 500, data: response}
        },
        *putNKN({ payload } , { call }) {
            const response = yield call(putSys, {Id: 1, Value: payload, Key: "NKN"})
            if (response) { return { status: 200, data: response} }
            return { status: 500, data: response}
        },

        *getNKX(_ , { call }) {
            const response = yield call(fetchSys, 2)
            if (response) {
                return { status: 200, data: response}
            }
            return { status: 500, data: response}
        },
        *putNKX({ payload } , { call }) {
            const response = yield call(putSys, {Id: 2, Value: payload, Key: "NKX"})
            if (response) { return { status: 200, data: response} }
            return { status: 500, data: response}
        },

        *getReportTime(_ , { call }) {
            const response = yield call(fetchSys, 3)
            if (response) {
                return { status: 200, data: response}
            }
            return { status: 500, data: response}
        },
        *putReportTime({ payload } , { call }) {
            const response = yield call(putSys, {Id: 3, Value: payload, Key: "ReportTime"})
            if (response) { return { status: 200, data: response} }
            return { status: 500, data: response}
        },

        *getMehPer(_ , { call }) {
            const response = yield call(fetchSys, 4)
            if (response) {
                return { status: 200, data: response}
            }
            return { status: 500, data: response}
        },
        *putMehPer({ payload } , { call }) {
            const response = yield call(putSys, {Id: 4, Value: payload, Key: "MehPer"})
            if (response) { return { status: 200, data: response} }
            return { status: 500, data: response}
        },

        *getMehNum(_ , { call }) {
            const response = yield call(fetchSys, 5)
            if (response) {
                return { status: 200, data: response}
            }
            return { status: 500, data: response}
        },
        *putMehNum({ payload } , { call }) {
            const response = yield call(putSys, {Id: 5, Value: payload, Key: "MehNum"})
            if (response) { return { status: 200, data: response} }
            return { status: 500, data: response}
        },


    },

    reducers: {
        
    },
}
export default Model;
  